<!DOCTYPE html>
<html lang="zh-cmn-Hans">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title>百度地图API</title>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=GoGWhdirTggk1lUt58gQZtRDjapmGFGO"></script>
</head>
<body>  
   <div id="allmap" style="width: 800px;height: 500px;"></div>
</body>  
</html>  
<script type="text/javascript">  
var map = new BMap.Map("allmap");
var point = new BMap.Point(108.565134,34.135309);
map.centerAndZoom(point,12);
//北纬N：34°13′53.09″ 东经E：108°56′51.34″
var geolocation = new BMap.Geolocation();
geolocation.getCurrentPosition(function(r){
	if(this.getStatus() == BMAP_STATUS_SUCCESS){
		var mk = new BMap.Marker(r.point);
		map.addOverlay(mk);
		map.panTo(r.point);
		alert('您的位置：'+r.point.lng+','+r.point.lat);
	}
	else {
		alert('failed'+this.getStatus());
	}        
});


</script>